{% extends 'preheat/base.html' %}

{% block title %}添加CDN域名 - CDN预热平台{% endblock %}

{% block page_title %}添加CDN域名{% endblock %}

{% block content %}
<div class="card">
    <div class="card-header">
        <h3 class="mb-0">CDN域名信息</h3>
    </div>
    <div class="card-body">
        <form method="post">
            {% csrf_token %}
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group mb-4">
                        <label for="id_domain" class="form-label font-weight-bold">CDN域名</label>
                        {{ form.domain }}
                        {% if form.domain.errors %}
                        <div class="invalid-feedback d-block">
                            {{ form.domain.errors }}
                        </div>
                        {% endif %}
                        <small class="form-text text-muted">请输入完整的CDN域名，例如：example.com</small>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group mb-4">
                        <label for="id_vendor" class="form-label font-weight-bold">厂商</label>
                        {{ form.vendor }}
                        {% if form.vendor.errors %}
                        <div class="invalid-feedback d-block">
                            {{ form.vendor.errors }}
                        </div>
                        {% endif %}
                        <small class="form-text text-muted">请选择CDN服务提供商</small>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group mb-4">
                        <label for="id_project" class="form-label font-weight-bold">归属项目</label>
                        {{ form.project }}
                        {% if form.project.errors %}
                        <div class="invalid-feedback d-block">
                            {{ form.project.errors }}
                        </div>
                        {% endif %}
                        <small class="form-text text-muted">请输入该域名归属的项目名称</small>
                    </div>
                </div>
            </div>
            
            <div class="d-flex justify-content-between mt-4">
                <a href="{% url 'preheat:cdn_domain_list' %}" class="btn btn-outline-secondary">
                    <i class="fas fa-arrow-left mr-2"></i>返回列表
                </a>
                <div>
                    <button type="submit" class="btn btn-primary">
                        <i class="fas fa-save mr-2"></i>保存
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
{% endblock %}

{% block extra_css %}
<style>
    .form-control {
        margin-bottom: 5px;
    }
    
    .form-group {
        background-color: #f8f9fa;
        padding: 15px;
        border-radius: 5px;
        border-left: 4px solid #007bff;
    }
    
    .form-label {
        color: #2c3e50;
        font-weight: 600;
        margin-bottom: 8px;
    }
    
    .form-control:focus {
        border-color: #80bdff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }
    
    .btn-primary {
        padding: 8px 20px;
        font-weight: 500;
    }
    
    .btn-outline-secondary {
        padding: 8px 20px;
        font-weight: 500;
    }
</style>
{% endblock %}